<%@ page language="java" 
	contentType="text/html; 
	charset=UTF-8"
	pageEncoding="UTF-8"
	import="connectMysql.TestConnect"
	%>
<!DOCTYPE html>
<html>
<head>
    <title>教师批改作业</title>
    <meta charset="UTF-8">
    <style>
        body {
        	align-items: center;
        	justify-content: center;
            font-family: Arial, sans-serif;
            margin: 0;
            padding: 20px;
        }
        h1 {
            font-size: 24px;
        }
        h2 {
            font-size: 18px;
        }

        form {
            margin-top: 20px;
        }

        label {
            display: block;
            font-weight: bold;
            margin-bottom: 5px;
        }

        input[type="number"],
        textarea {
            width: 300px;
            padding: 5px;
            font-size: 16px;
            border-radius: 5px;
            border: 1px solid #ccc;
        }

        input[type="submit"] {
            padding: 10px 20px;
            font-size: 16px;
            background-color: #4CAF50;
            color: white;
            border: none;
            border-radius: 5px;
            cursor: pointer;
        }
    </style>
</head>
<body>

	<%
	String work_id=request.getParameter("work_id");
	String stud_name=request.getParameter("stud_name");
	String class_name=request.getParameter("class_name");
	String if_submit=request.getParameter("if_submit");
	%>
	<%String user_id=request.getParameter("user_id"); %>
    <script>
    	if("<%=if_submit%>"=="未提交"){
    		alert("该学生作业尚未提交！");

    	}else{
    		<%String answer=connectMysql.TestConnect.get_sombody_answer(class_name,work_id,stud_name);%>
    	}
        // 假设以下是从服务器获取的学生答案

        // 监听提交批改按钮的点击事件
        
        function buttonfun(){
        	var score = document.getElementById("score").value;
            var comment = document.getElementById("comment").value;
            window.location="judeg_message_check.jsp?user_id=<%=user_id%>&work_id=<%=work_id%>&stud_name=<%=stud_name%>"+
            		"&class_name=<%=class_name%>&score="+score+"&comment="+comment;
        }
    </script>
    <h1><%= stud_name%>——学生答案</h1>
    
	
    <form id="gradingForm">
    	<label for="score">答案:</label>
    	<input  type="text"  rows="4" cols="50" value="<%=answer %>"></input><br><br>
        <label for="score">分数:</label>
        
        <input type="number" id="score" name="score" min="0" max="100" required><br>

        <label for="comment">评语:</label><br>
        <textarea id="comment" name="comment" rows="4" cols="50" required></textarea><br>

        <input type="button" onclick="buttonfun()" value="提交批改">
    </form>
</body>
</html>

</html>
